package com.ljf.daily.softwareautorecord.infra.repository.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.ljf.common.exception.ServiceException;
import com.ljf.common.infra.repository.impl.BasisRepositoryImpl;
import com.ljf.common.utils.CollectionUtil;
import com.ljf.daily.softwareautorecord.domain.repository.DailyDatSoftwareAutoWithdrawalRepository;
import com.ljf.daily.softwareautorecord.dto.query.DailyDatSoftwareAutoWithdrawalQuery;
import com.ljf.daily.softwareautorecord.infra.mapper.DailyDatSoftwareAutoWithdrawalMapper;
import com.ljf.daily.softwareautorecord.model.DailyDatSoftwareAutoWithdrawal;
import com.ljf.daily.softwareautorecord.vo.DailyDatSoftwareAutoWithdrawalVO;
import org.springframework.stereotype.Component;

/**
 * 赚钱软件自动记录金额  数据访问接口实现
 *
 * @author LJF
 * @since 2025-03-16
 */
@Component
public class DailyDatSoftwareAutoWithdrawalRepositoryImpl extends BasisRepositoryImpl<DailyDatSoftwareAutoWithdrawalMapper, DailyDatSoftwareAutoWithdrawal, DailyDatSoftwareAutoWithdrawalQuery, DailyDatSoftwareAutoWithdrawalVO> implements DailyDatSoftwareAutoWithdrawalRepository {

    @Override
    protected QueryWrapper<DailyDatSoftwareAutoWithdrawal> fillWrapper(DailyDatSoftwareAutoWithdrawalQuery query, boolean sort) throws ServiceException {
        QueryWrapper<DailyDatSoftwareAutoWithdrawal> wrapper = super.fillWrapper(query, sort);
        if (CollectionUtil.isNotEmpty(query.getSoftwareAutoCodeList())) {
            wrapper.in(DailyDatSoftwareAutoWithdrawal.COL_SOFTWARE_AUTO_CODE, query.getSoftwareAutoCodeList());
        }
        return wrapper;
    }

}
